package com.seanzx.common;

public enum ResultCode {
    SUCCESS("000000", "success"),
    // 1XXXXX client error
    DATABASE_ALREADY_EXISTS("100001", "database is already exists"),
    CANNOT_DROP_CURRENT_DATABASE("100002", "can`t drop current database"),
    DATABASE_NOT_EXISTS("100003", "database not exists"),
    TABLE_ALREADY_EXISTS("100004", "table is already exists"),
    TABLE_NOT_EXISTS("100005", "table not exists"),
    SQL_ANALYSIS_FAILED("100006", "SQL analysis failed, please check your SQL schema."),
    NO_SUCH_PROPERTY("100007", "no such property"),
    // 2XXXXX server error
    IO_EXCEPTION("200001", "io exception occurred"),
    CREATE_DATABASE_FAILED("200002", "create database failed, caused by unknown io exception"),
    DROP_DATABASE_FAILED("200003", "drop database failed, caused by unknown io exception"),
    CREATE_TABLE_FAILED("200004", "create table failed, caused by unknown io exception"),
    TABLES_CONFIGURATION_MISSING("200005", "configuration of tables is missing"),
    COLUMNS_CONFIGURATION_MISSING("200006", "configuration of columns is missing"),
    DELETE_DATA_FAILED("200007", "delete data failed, caused by unknown io exception")
    ;

    private final String code;
    private final String message;

    ResultCode(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public String getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
}
